package cn.manyufun.myf.common.commonutils;


import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;

/**
 * @author Kevin Xiao
 * @date Create Date: 2017-12-26
 * @Description
 */

public class LogUtils {
    public static boolean DEBUG_ENABLE = false;// 是否调试模式

    /**
     * 在application调用初始化
     */
    public static void logInit(boolean debug) {
        DEBUG_ENABLE = debug;
        Logger.addLogAdapter(new AndroidLogAdapter());
    }

    public static void logd(String tag, String message) {
        if (DEBUG_ENABLE) {
            Logger.d(tag, message);
        }
    }

    public static void logd(String message) {
        if (DEBUG_ENABLE) {
            Logger.d(message);
        }
    }

    public static void logv(String message, Object... args) {
        Logger.v(message, args);
    }

    public static void loge(Throwable throwable, String message, Object... args) {
        Logger.e(throwable, message, args);
    }

    public static void loge(String message, Object... args) {
        Logger.e(message, args);
    }

    public static void logi(String message, Object... args) {
        Logger.i(message, args);
    }

    public static void logw(String message, Object... args) {
        Logger.v(message, args);
    }

    public static void logwtf(String message, Object... args) {
        Logger.wtf(message, args);
    }

    public static void logjson(String message) {
        Logger.json(message);
    }

    public static void logxml(String message) {
        Logger.xml(message);
    }
}
